package com.macro.mall.task;

import cn.hutool.core.date.DateUtil;
import com.macro.mall.service.SitQuietlyClockService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

/**
 * Created by @author dabaoqiang on 2024/5/24.
 */
@Slf4j
@Component
public class DailyTask {

    @Resource
    private SitQuietlyClockService sitQuietlyClockService;

    @Scheduled(cron = "0 0 15 * * ?") // 每天下午3点到达
    public void processUnClockTask() {
        log.info("task.DailyTask.processUnClockTask开始，当前时间，" + DateUtil.now());
        long startTime = System.currentTimeMillis();
        sitQuietlyClockService.processUnClockTask();
        long endTime = System.currentTimeMillis();
        long duration = endTime - startTime;
        log.info("task.DailyTask.processUnClockTask,所耗费时间为：" + duration + "毫秒");

    }
}
